const { exec } = require("child_process");
const fs = require("fs");
const path = require("path");

const shrinkwrapUrl = path.join(__dirname, "../node_modules/element-theme/npm-shrinkwrap.json");
const shrinkwrapDir = path.join(__dirname, "../node_modules/element-theme");
const shrinkwrap = {
    "dependencies": {
        "graceful-fs": {
            "version": "4.2.2"
        }
    }
}
if (fs.existsSync(shrinkwrapDir)) {
    fs.writeFileSync(shrinkwrapUrl, JSON.stringify(shrinkwrap), "utf-8");
    exec(`cd ${shrinkwrapDir} && npm install`, (_, output) => {
        console.log("element-theme inited!");
    })
}